Skip to content

Conversation

evenkkl
Copy link
Member

@evenkkl evenkkl commented Oct 26, 2026

Closes #13

Summary

  • Added a filter panel to the search page for genre, decade and "Has reviews", with the server's facet count next to each option.
  • Options that would return zero results are hidden, so a click never leads to an empty page. A selected option stays visible so it can be unticked, and a "Clear filters" button resets everything.
  • Filters live in the URL (genres, decades, reviewed=1), so reload, back/forward and shared links work. Changing a filter always starts on the first page, because the cursor is never part of the search state.
  • Added a hasReviews filter to AlbumSearchInput and a reviewedCount field to AlbumConnection, both computed in SQL.
  • Updated the README, architecture, data-model and AI usage docs.

Decisions from the issue

  • Genres keep AND within the category, as decided earlier in the group. With AND, the current genre counts are already correct (a genre's count is exactly what ticking it gives), so they were not changed. Decade counts and the reviewed count leave out their own filter.
  • Countries are left to Country facet and country filter #25 (M4).

Verification

  • pnpm format:check
  • pnpm lint
  • client and server typecheck
  • 75 client tests and 39 server tests (new: FilterPanel tests incl. axe, a genre-filter flow in App, URL state for reviewed, the SQL filter for hasReviews)
  • pnpm -r build
  • PostgreSQL integration tests were skipped (no TEST_DATABASE_URL locally), and the panel has not been checked in a browser against the database yet.

@evenkkl evenkkl requested a review from a team as a code owner October 26, 2026 18:48
@evenkkl evenkkl linked an issue Oct 26, 2026 that may be closed by this pull request
6 tasks
Copy link
Member

@robertky robertky left a comment •

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description now records the group’s decision as AND within genres.

One mismatch remains: issue #13 still says facet counts should exclude their own filter dimension, while this implementation keeps selected genres in the genre counts and shows their intersections. Please update issue #13 to match the agreed behavior: genre counts use the active genre selections, while decade counts exclude selected decades but keep the other active filters. Please make the acceptance criteria explicit so they match the implementation.

@rachelks rachelks changed the title Feat/13 filter facets feat: #13 filter facets Oct 27, 2026
@evenkkl
Copy link
Member Author

evenkkl commented Oct 28, 2026

Review feedback addressed:

  • Issue Server-side filtering with facet counts #13 updated to match the implementation: AND within genres, decade counts exclude selected decades, explicit acceptance criteria.
  • Filter list is behind a Filters button on small screens.
  • Latest main merged and README reconciled with pagination.
  • CI passes. PostgreSQL integration tests pass locally (15/15), and the filter panel was checked against a local database. Docker test on PostgreSQL 18 pending before merge.

Ready for another review.

@evenkkl evenkkl requested a review from robertky October 28, 2026 17:37
Copy link
Member

@rachelks rachelks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the full test suite locally against PostgreSQL, and all tests passed, including the integration tests. The filtering and facet counts also behaved as expected during manual testing.

I've left a comment about selected filters disappearing when they're omitted from the API response. I think this should be fixed before merging.

Could we also add a few PostgreSQL integration tests covering the AND/OR filter combinations and facet counts?

One small documentation update: docs/architecture.md currently says the URL contains the search term, genres and sort, but it now also supports decades and the reviewed filter. Could we update that description to reflect the new functionality?

robertky
robertky approved these changes Oct 29, 2026 •
robertky
robertky previously approved these changes Oct 29, 2026
Copy link
Member

@robertky robertky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating issue #13. I rechecked the facet behavior against the clarified criteria: genre filters use AND, and genre facet counts use the active filters. Decade facet counts exclude selected decades while keeping the other active filters. This resolves my requested change. CI is green. Approving.

@evenkkl
Copy link
Member Author

evenkkl commented Oct 29, 2026

Review feedback addressed:

  • Selected genres and decades are now always returned in the facets (count 0 when nothing matches), so they stay visible and can be removed. Regression tests on client and server.
  • Filters open from a dropdown button on all screen sizes, matching the UI specification.
  • Added PostgreSQL integration tests for AND between genres, OR between decades, the facet counts and selected filters with no matches.
  • README now explains the difference between genre and decade counts, and architecture.md lists decades and reviewed in the URL.
  • Latest main merged.

Ready for another review.

@evenkkl evenkkl requested a review from rachelks October 29, 2026 14:56
Copy link
Member

@rachelks rachelks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retested PR #65 locally after the latest changes. All 88 backend tests passed, including the PostgreSQL integration tests, and manual testing of the filters, sorting, pagination and URL behavior looks good.

The updated filter dropdown works well, and the previous review feedback appears to be addressed. Looks good to me!

@rachelks rachelks merged commit 0cd39d7 into main Oct 29, 2026
2 checks passed
@rachelks rachelks deleted the feat/13-filter-facets branch October 29, 2026 15:36
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Server-side filtering with facet counts
3 participants